﻿using System.Collections.Generic;
using Entitas;
class EnemyItemDropSystem :ReactiveSystem<EnemyEntity>
{
    public EnemyItemDropSystem(Contexts contexts) : base(contexts.enemy)
    {

    }

    protected override void Execute(List<EnemyEntity> entities)
    {
        foreach(var e in entities)
        {
            ServiceManager.DebugMessageService.Print("Dropped item");
        }
    }

    protected override bool Filter(EnemyEntity entity)
    {
        return entity.hasHitPoint && entity.hitPoint.value == 0;
    }

    protected override ICollector<EnemyEntity> GetTrigger(IContext<EnemyEntity> context)
    {
        return context.CreateCollector(EnemyMatcher.HitPoint.AddedOrRemoved());
    }
}
